package com.rd.student.dashuju.zhengruixian.test0726;

public class TestSynchronized1 implements Runnable{
    @Override
    public void run(){
        synchronized (this){
            System.out.println("同步代码块 对象锁");
        }
        synchronized (TestSynchronized1.class){
            System.out.println("同步代码块  类锁");
        }
    }
    public synchronized void info() {
        System.out.println("同步方法，对象锁");

    }
    public static synchronized void infoStatic(){
        System.out.println("同步方法 类锁");
    }

    public static void main(String[] args) {
        TestSynchronized1 ts=new TestSynchronized1();
        Thread t=new Thread(ts);
        t.start();
    }
    }

